home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Precision Software Appli…tions Silver Collection 4
/
Precision Software Applications Silver Collection Volume 4 (1993).iso
/
database
/
sr_info.exe
/
FILTERCR.PRG
< prev
next >
Wrap
Text File
|
1990-04-11
|
2KB
|
73 lines
**************************************************************************
** FILTER.PRG ***
** (C) Copyright 1990, Sub Rosa Publishing Inc.
** A demonstration program provided to SR-Info and VP-Info users.
** This program may be copied freely. If it is used in commercial code,
** please credit the source, Sub Rosa Publishing Inc.
**
** FILTERCR demonstrates the use of sequential file functions to produce
** an altered copy of given file.
** FILTERCR is compatible with all current versions of SR-Info and VP-Info.
**
** FILTERCR provides a facility not usually available on text editors.
** It replaces a selected character in a file with a carrige return and
** a line feed. One use of this program is to replace a long list
** of comma-separated items (as in a 'C' program) with a list presenting
** one item per line.
**
** Bernie Melman and Sid Bursten
** April 1,1990
***************************************************************************
SET raw on ; no extra space between print fields
* initialize variables
infile=blank(12)
outfile=blank(12)
key_char=' '
inp_char=' '
WINDOW ; get rid on any window left open.
ERASE ; clear screen
* set up input screen - note that all variables used have been initialized
* .. lines are picture clauses forcing upper case for infile and outfile
TEXT
.. infile !!!!!!!!!!!!
.. outfile !!!!!!!!!!!!
INPUT FILE: @infile
OUTPUT FILE: @outfile
Substitute CR/LF for this character: @key_char
ENDTEXT
READ
*; get rid of old output
DELETE file &outfile ; note if file name has no extension, include '.' in name
?
IF ropen(infile); don't even try if files won't open!
IF wopen(outfile,2)
? ;start new line
DO WHILE in(inp_char); start of main loop
?? inp_char; echo characters to screen
IF inp_char <> key_char
ok= OUT(inp_char,2)
ELSE
ok= out(chr(13),2)
ok= out(chr(10),2)
ENDIF
ENDDO ; end of main loop
* close files
IF .not. close(1)
? "Problem closeing file :"+infile
ENDIF
IF .not. close(2)
? "Problem closing output file :"+outfile
ENDIF
* done
ELSE
? "Unable to open output file :"+outfile
ENDIF
ELSE
? "Unable to open input file :"+infile
ENDIF
*
* *** end of FILTERCR.PRG ***